﻿#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    first = new FirstWidget;
    registers = new registerWidget;

    connect(ui->btn_login, &QPushButton::clicked, this, &Widget::dologin);
    connect(ui->btn_register, &QPushButton::clicked, this, &Widget::doregister);

    connect(first, &FirstWidget::dofirst_goWidget, this, &Widget::dofirst_back);
    connect(registers, &registerWidget::doregister_gowidget, this, &Widget::doregister_back);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::dologin()
{
    this->hide();
    first->show();
}

void Widget::doregister()
{
    this->hide();
    registers->show();
}

void Widget::dofirst_back()
{
    first->hide();
    this->show();
}

void Widget::doregister_back()
{
    registers->hide();
    this->show();
}
